-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
Sorry @NegativeMjark for splitting out the ProfileHandler in this PR, but it fixes the tests.... |
synapse/handlers/profile.py
Outdated
@@ -182,3 +220,44 @@ def _update_join_states(self, requester): | |||
"Failed to update join event for room %s - %s", | |||
room_id, str(e.message) | |||
) | |||
|
|||
def _update_remote_profile_cache(self): | |||
"""Called periodically to check profiles of remote users we havent' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
havent'
synapse/handlers/profile.py
Outdated
is_subcscribed = yield self.store.is_subscribed_remote_profile_for_user( | ||
user_id, | ||
) | ||
if not is_subcscribed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subcscribed
synapse/handlers/profile.py
Outdated
self.ratelimiter = hs.get_ratelimiter() | ||
|
||
# AWFUL hack to get at BaseHandler.ratelimit | ||
self.base_handler = BaseHandler(hs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I want to know why this is needed, but future generations deserve to know why we did what we did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I actually I can still just inherit from BaseHandler. At this point I think I was close to purging all the unit tests with fire so may not have been at my best.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from spelling, grammar and justification.
@@ -55,3 +57,99 @@ def set_profile_avatar_url(self, user_localpart, new_avatar_url): | |||
updatevalues={"avatar_url": new_avatar_url}, | |||
desc="set_profile_avatar_url", | |||
) | |||
|
|||
def get_from_remote_profile_cache(self, user_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually called anywhere? Or is the cache write-only at the moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is TBC...
@matrixbot restest this please |
4 similar comments
@matrixbot restest this please |
@matrixbot restest this please |
@matrixbot restest this please |
@matrixbot restest this please |
@matrixbot retest this please |
4 similar comments
@matrixbot retest this please |
@matrixbot retest this please |
@matrixbot retest this please |
@matrixbot retest this please |
We want to be able to return profiles of users who are in the group when requested, which ideally needs some sort of profile cache.
This is done by adding the user to a cache table and periodically going and checking if there are updates. To add a remote user to the table:
is_subscribed_remote_profile_for_user(user_id)
returns true for the useradd_remote_profile_cache
with an up to date copy of their profileis_subscribed_remote_profile_for_user
ensures that we only bother fetching profiles for users we really do actually care about.PRs to follow: